<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    //return $router->app->version();
    echo phpinfo();
//    echo '<div style="margin: 20% auto; width: 50%; text-align: center; color: #555; cursor: pointer;">欢迎来到仙福缘官方商城</div>';
});


//接口文档
$router->get('/doc', function () use ($router) {
    return redirect('/doc/index.html');
});


//后台接口
$router->group(['prefix'=>'api/admin', 'namespace'=>'Admin'], function () use ($router) {
    $router->post('login', 'IndexController@dologin'); //登录
    $router->post('login/log/index', 'IndexController@loginlog'); //登录日志
    $router->post('leftmenu', 'IndexController@leftMenu'); //左侧菜单
    $router->post('tongji', 'IndexController@tongji'); //首页统计
    $router->post('logs/index', 'IndexController@getLogIndex'); //后台错误日志
    $router->post('index/kanban', 'IndexController@indexTongji'); //首页数据看板
    $router->post('caiwu/kanban', 'IndexController@caiwuTongji'); //财务数据看板
    //功能
    $router->post('action/index', 'IndexController@getActionIndex'); //功能列表
    $router->post('action/one', 'IndexController@getActionOne'); //功能一个
    $router->post('action/parent', 'IndexController@getParent'); //父级功能
    $router->post('action/update', 'IndexController@actionUpdate'); //保存
    //管理员
    $router->post('admin/index', 'AdminController@getIndex');
    $router->post('admin/one', 'AdminController@getOne');
    $router->post('admin/save', 'AdminController@save');
    $router->post('admin/pwd', 'AdminController@setPwd');
    $router->post('auth/list', 'AdminController@authList');
    $router->post('auth/modify', 'AdminController@setAuth');
    //用户
    $router->post('user/index', 'UserController@getUserIndex');
    $router->post('user/del', 'UserController@del');
    $router->post('user/option', 'UserController@getOption');
    $router->post('user/trace/index', 'UserController@getTraceIndex'); //浏览历史
    $router->post('xieyi/one', 'UserController@xieyiOne'); //用户协议获取
    $router->post('xieyi/modify', 'UserController@setXieyi'); //用户协议获取
    $router->post('qy/one', 'UserController@qyOne'); //用户权益获取
    $router->post('qy/modify', 'UserController@setQy'); //用户权益获取
    $router->post('user/recharge/index', 'UserController@getRechargeIndex'); //用户充值记录
    $router->post('user/tixian/index', 'UserController@getTixianIndex'); //用户提现记录
    $router->post('user/order/index', 'UserController@getOrderIndex'); //用户消费统计
    $router->post('user/vip/modify', 'UserController@setVip'); //设置折扣
    $router->get('user/test', 'UserController@test');
    $router->post('user/modify', 'UserController@modify');
    $router->post('user/out', 'UserController@getOut');
    $router->post('user/txauth/list', 'UserController@txAuthList');
    $router->post('user/txauth/modify', 'UserController@txAuthModify');
    $router->post('user/bank/list', 'UserController@bankList');
    $router->post('user/bank/default/modify', 'UserController@bankDefaultModify');
    $router->post('user/fxlist', 'UserController@fxlist');
//    //微信配置
//    $router->post('wx/config/one', 'UserController@wxConfigOne');
//    $router->post('wx/config/modify', 'UserController@wxConfigModify');

    require_once('scht.php');
    /**
     * 二期渠道端
     */
    $router->group(['prefix'=>'qudao', 'namespace'=>'Qudao'], function () use ($router) {
        require_once('qdht.php');
    });
    /**
     * 二期积分商城配置
     */
    //积分
    $router->post('erqi/jifen', 'PointController@getList');
    $router->post('erqi/jf2g', 'PointController@orderList');
    $router->post('erqi/jforder/auth', 'PointController@auth');
    $router->post('erqi/jforder/send', 'PointController@send');
    $router->group(['prefix'=>'point', 'namespace'=>'Point'], function () use ($router) {
        require_once('ht-point.php');
    });

    //二期素材中心
    $router->group(['prefix'=>'erqi', 'namespace'=>'Erqi'], function () use ($router) {
        require_once('erqi.php');
    });
});


//小程序接口
$router->group(['prefix'=>'api/xcx', 'namespace'=>'ApiXcx'], function () use ($router) {
    require_once('scxcx.php');
});


////渠道端小程序接口
//$router->group(['prefix'=>'api/qd', 'namespace'=>'ApiQdXcx'], function () use ($router) {
//    require_once('tpqd.php');
//});


require_once('qdxcx.php'); //渠道小程序